package kz.kstu.scantest.business.entity.guide;

import kz.kstu.scantest.business.entity.CommonEntityConstant;
import kz.kstu.scantest.business.entity.Identifiable;

import javax.persistence.*;

/**
 * @author Filipp_Stankevich
 *         created: 9/22/11 6:32 PM
 */
@NamedQuery(name = CommonEntityConstant.FIND_STATISTICS, query = "select s from Statistic s")


@Entity
@Table(name = "STATISTIC")
public class Statistic implements Identifiable {

    private Long id;
    private Integer count;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "COUNT")
    public Integer getCount() {
        return count;
    }

    public void increment() {
        if (count == null) {
            count = 0;
        }
        count++;
    }

    public void setCount(Integer count) {
        this.count = count;
    }
}
